<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>商品列表</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
   	<link rel="stylesheet" type="text/css" href="<c:url value="/css/list.css"/>">
   	<script type="text/javascript" src="<c:url value="/js/jquery.js"/>"></script>
    <script type="text/javascript">
     $(document).ready(function() {
		
		$(".self").mouseover(function(){
	      $(this).css("cursor","pointer");
	    });
		$(".self").click(function(){

		    if(${loginedCustomer.realName=='游客'}){
		       alert("请先登录");
		       return false;
		    }
		});
	
	
	
	 });
    //pageno 指定页码数
         function doQuery(pageno)
         {
	     	var sss=$(":input[name=pageNo]").val();
     // 不可行   	var sss=document.getElementsByName("ctg_no").value;
         	if(isNaN(sss)){
	            alert("只能为数字!");
	            return false;
	        }
           if(pageno<1 || pageno>${page.totalPageNum})
           {
              alert("页号超出范围，有效范围：[1-"+${page.totalPageNum}+"]!");
              ${'pageNo'}.select();
              return;
           }
           //location.href="<c:url value="/indentMgr?act=for_list"/>"+"&page_no="+pageno;
           document.forms[0].page_no.value=pageno;
           document.forms[0].submit();
         }
         function doQuery2(){
           
           var pageNo=document.getElementById("pageNo").value;
           doQuery(pageNo);
           
         }
         onsubmit=function(){
     //    	alert("ddd");
      	var sss=$(":input[name=pageNo]").val();
     // 不可行   	var sss=document.getElementsByName("ctg_no").value;
         	if(isNaN(sss)){
	            alert("只能为数字!");
	            return false;
	        }
	     }

		$(document).ready(function(){
	      $(".item-action a").mouseover(function(){
	    	
	      $(this).css("cursor","pointer");
	    });
	    });
	/*function addtocart(no){
		   	alert("ddd");
		   	
	       $(".item-action a").href="<c:url value="/goodMgr?act=addToShoppingCart&goods_no="/>"+no;
	    }
	   */

    </script>
    
    <style>
    body{
           font-family:arial,"Hiragino Sans GB","Microsoft Yahei",sans-serif;
           font-size:14px;
           line-height:20px;
           color:rgb(101,109,120)

    }
   .good-list{
   			margin-left:370px;
            width:950px;
            overflow:hidden;
   }
   .goods-sublist{
    margin:10px;
    padding:10px;
    list-style-type:none;  
   }
   .goods-sublist li{
   	margin:10px;
    positionLrelative;
    float:left;
    width:237px;
    border-style:solid;
    border-color:rgb(237,237,237);
    -moz-border-top-colors:none;
    -moz-border-right-colors:none;
    -moz-border-bottom-colors:none;
    -moz-border-left-colors:none;
    border-image:none;
    border-width:0px 1px 1px 0px;
    background:none repeat scroll 0% 0% rgb(255,255,255);
    overflow:hidden;
   }
   .goods-item{
    position:relative;
    height:295px;
    margin:5px;
    padding:10px 15px;
    background:none repeat scroll 0% 0% rgb(255,255,255);   
   }
   .goods-item .item-thumb{
    padding:25px 0px;
    text-align:center;
   }
   a{color:rgb(101,109,120);
     text-decoration:none;
    }
   .goods-item .item-thumb img{
     width:180px;
     height:180px;
    background:url("http://p.www.xiaomi.com/zt/2013/loading.gif") no-repeat scroll 50% 50% transparent;
   }
   img{
    vertical-align:center;
    border:0px none;   
   }
   .goods-item .item-name {
    width:100%;
    margin:0px;
    white-space:nowrap;
    text-overflow:ellipsis;
    overflow:hidden;
    font-size:14px;
    font-weight:400;
    line-height:1.3;
   }
   .goods-item .item-price{
    line-height:1.3;
    color:rgb(67,74,84);
   }
   .goods-item .item-action{
    margin:5px 0px 0px;
    font-size:12px;
    cursor:point;

   }

 </style>

  </head>
  
  <body>
    <div id="goodlist" class="good-list">
     <ul class="goods-sublist">
      <c:forEach items="${page.pageContent}" var="goods"> 
      <li>
       <div class="goods-item">
         <div class="item-thumb"><a  href="<c:url value="goodMgr?act=showGood&goodNo=${goods.goodsNo}"/>"><img src="<c:url value="/goodMgr?act=get_pic&g_no=${goods.goodsNo}"/>" alt="${goods.goodsName}"></a></div>
         <h3 class="item-name"><a href="<c:url value="goodMgr?act=showGood&goodNo=${goods.goodsNo}"/>">${goods.goodsName}</a></h3>
         <div class="item-price">${goods.goodsPrice }</div>
         <div class="item-action"><a href="<c:url value="goodMgr?act=addToShoppingCart&page_no=${page.pageNo}&ctg_no=${category.categoryNo}&goodNo=${goods.goodsNo}&good_num="/>1" class="self" onclick="addtocart(${goods. goodsNo});" data-gid="1823" data-disabled="false" data-package="false" ><span class="icon-common icon-common-plus"></span>加入购物车</a></div>
       	 <input type="hidden" name="good_num" value=1/>
        </div>
       </li>
      </c:forEach>
      <c:if test="${not empty addok}">
      	 <script type="text/javascript">
      	 alert("${addok}");
      	 </script>
      </c:if>
      </ul>
     </div>
     <div class="page_infos">
	          <form class="search_form" action="<c:url value="goodMgr"/>" method="post">
	          <input type="hidden" name="act" value="list_all" size="10"/>
              <input type="hidden" name="page_no" value=""/> 
              <input type="hidden" name="ctg_no" value="${category.categoryNo}"/>
	            共${page.totalRecNum}条, 当前显示${page.startIndex}-${page.endIndex}条, 第${page.pageNo}/${page.totalPageNum}页
	           |
	           <c:if test="${page.pageNo>1}">
	             <span class="linkspan" onclick="doQuery(1)">首页</span>&nbsp;
	           </c:if>
	           <c:if test="${page.prePage}">
	             <span class="linkspan" onclick="doQuery(${page.pageNo-1})">上一页</span>&nbsp;
	           </c:if>
	           <c:if test="${page.nextPage}">
	             <span class="linkspan" onclick="doQuery(${page.pageNo+1})">下一页</span>&nbsp;
	           </c:if>
	           <c:if test="${page.pageNo!=page.totalPageNum}">
	             <span class="linkspan" onclick="doQuery(${page.totalPageNum})">末页</span>&nbsp;
	           </c:if>
	           |
	            到<input type="text" name="pageNo" id="pageNo" size=4 style="text-align:right;" onkeypress="onlynumber();"/>页
	        <button onclick="doQuery2();">跳 转</button>         		           	           	              
		   </form>
	  </div>
      <c:if test="${empty page.pageContent}">
          <div class="no_found" style="color:grey;front-size:45px;margin-left:380px">
                                    对不起,无法查找到您所要求的商品信息.......
          </div>
      </c:if>
  </body>
</html>
